package projcet.test.student.student;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;

public class MainActivity extends AppCompatActivity {

    public final static String EXTRA_MESSAGE = "com.product.is.app";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        skipRoute();
    }

    public void skipRoute() {
        ImageButton addRoute = (ImageButton) findViewById(R.id.addRoute);
        ImageButton queryRoute = (ImageButton) findViewById(R.id.queryRoute);
        Button addTeacher = (Button) findViewById(R.id.addTeacher);
        Button selectAll = (Button) findViewById(R.id.selectAll);

        /**
         * 跳转至添加
         */
        addRoute.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(MainActivity.this,AddActivity.class);
                startActivity(intent);
                finish();
            }
        });
        /**
         * 跳转根据学号查询
         */
        queryRoute.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(MainActivity.this,QueryActivity.class);
                startActivity(intent);
            }
        });
        /**
         * 跳转添加教师与科目
         */
        addTeacher.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(MainActivity.this,AddOtherActivity.class);
                startActivity(intent);
            }
        });
        /**
         * 跳转查询所有
         */
        selectAll.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(MainActivity.this,ListActivity.class);
                startActivity(intent);
            }
        });

    }
}
